package torres.item;

import java.util.List;

import torres.item.effect.Effect;

/**
 * @author Torres
 * Represents an Equippable Item. Includes all the 
 * information necessary to modify the equipee's stats
 */
@SuppressWarnings("serial")
public class EquippableItem extends TakeableItem
{
	private int offensiveMod;
	private int armorMod;
	public enum Type{ 
		HEAD, LEFT, RIGHT, UPPER, LOWER;
	};
	public Type equipType;
	
	/**
	 * Creates a new EquippableItem with the specified name.
	 * @param name Name (and image name) of the item.
	 */
	public EquippableItem(String name) {
		super(name);
		offensiveMod = 0;
		armorMod = 0;
		equipType = Type.HEAD;
	}
	
	/**
	 * Creates a new EquippableItem with the specified effects.
	 * @param name Name (and image name) of the item.
	 * @param effects The effects that occur when equipping the item.
	 */
	public EquippableItem(String name, List<Effect> effects) {
		super(name,effects);
		offensiveMod = 0;
		armorMod = 0;
		equipType = Type.HEAD;
		//imageName = "dekuShield.png";
	}
	
	/**
	 * Creates a new EquippableItem with the specified stats.
	 * @param name Name (and image name) of the item.
	 * @param offMod The offensive modifier of the item.
	 * @param armMod The armor modifier of the item.
	 * @param equipType The kind of equipment this is: Head, Upper, Lower, Left, Right
	 */
	public EquippableItem(String name, int offMod, int armMod, Type equipType) {
		
		super(name);
		this.setOffensiveMod(offMod);
		this.setArmorMod(armMod);
		this.equipType = equipType;
	}
	
	/**
	 * Creates a new EquippableItem which is a copy of the specified item.
	 * @param item The item to be copied. 
	 */
	public EquippableItem(EquippableItem item) {
		this(item.getName(), item.getOffensiveMod(), item.getArmorMod(), item.getType());
	}
	
	
	/**
	 * Returns the offensive modifier of the item.
	 * @return The offensive modifier of the item. 
	 */
	public int getOffensiveMod() {
		
		return offensiveMod;
	}
	
	/**
	 * Returns the armor modifier of the item.
	 * @return The armor modifier of the item. 
	 */
	public int getArmorMod() {
		
		return armorMod;
	}
	
	/**
	 * Set the offensive modifier of this item to the specified value.
	 * @param offensiveMod  Value of the new offensive modifier.
	 */
	private void setOffensiveMod(int offensiveMod) {
		
		this.offensiveMod = offensiveMod;
	}
	
	/**
	 * Set the offensive modifier of this item to the specified value.
	 * @param offensiveMod  Value of the new offensive modifier.
	 */
	private void setArmorMod(int armorMod) {
		
		this.armorMod = armorMod;
	}
	
	/** Returns the enum Type of the item: Head, Upper, Lower, Left, Right
	 * @return The kind of equipment
	 */
	public Type getType()
	{
		return equipType;
	}
	
	
	/** Test if the Item is equippable.
	 * @return True, since this is an EquippableItem
	 */
	public boolean isEquippable() {
		
		return true;
	}
	
	public String getToolTip() {
		String ret="<html>Name: " + super.getName()+"<br>";
		ret += "Equip type: "+equipType+"<br>";
		ret += "Offensive Mod: "+offensiveMod+"<br>";
		ret += "Armor Mod: "+armorMod+"<br>";
		ret += "</html>";
		return ret;
	}
	
}
